<template>
  <div class="families-page">
    <el-table
      :data="familiesData"
      class="families-list">
      <el-table-column
        type="index"
        label="序号"
        width="120">
      </el-table-column>
      <el-table-column
        prop="apn"
        label="申请号"
        width="160">
      </el-table-column>
      <el-table-column
        prop="ttl"
        label="专利名称">
      </el-table-column>
      <el-table-column
        prop="isd"
        label="公开/公告日"
        width="100">
      </el-table-column>
      <el-table-column
        prop="prd"
        label="优先权日"
        width="120">
      </el-table-column>
      <el-table-column
        prop="score"
        label="相关度"
        width="110">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: {
    publicInfo: {
      type: Object
    }
  },
  data() {
    return {
      familiesData: []
    }
  },
  methods: {
    init() {
      let family_id = this.publicInfo.family_id;
      if( family_id == '-1' || family_id == '' ) return ;
      this.$post(this.$Url.search.commonSearch, {
        dbid:'patent',
        eSearch: 'MSFAM/' + this.publicInfo.family_id 
      }).then(res => {
        let data = res.data
        if (data) {
          let result = data.result || []
          let list = []
          for (let i in result) {
            let v = result[i]
            let obj = {
              apn: v.apn || '--', // 申请号
              ttl: v.ttl || '--', // 专利名称
              isd: v.isd || '--', // 公开/公告日
              prd: v.prd && v.prd.join('; ') || '--', // 优先权日
              score: v.score && (v.score.toFixed(2) + '%') || '--', // 相关度
            }
            list.push(obj)
          }
          this.familiesData = list
        }
      }).catch(err => {})
    }
  },
  mounted() {
    this.init()
  }
}
</script>

<style lang="scss" scoped>
.families-page {
  display: flex;
  max-height: 100%;
  overflow-y: auto;
  .families-list {
    flex: 1;
  }
}
</style>